package org.me;

import java.util.ArrayList;

import org.jivesoftware.smack.util.StringUtils;
import org.me.adapter.Adapter_MultiUserChat;
import org.me.utils.Koneksi;

import android.app.Activity;
import android.graphics.Typeface;
import android.os.Bundle;
import android.os.Handler;
import android.widget.ListView;
import android.widget.TextView;

public class MultiUserChat extends Activity {

	private String user_name;
//	static Handler mHandlermuc = new Handler();
//	static Runnable run_muc;
	public static ArrayList<String> room = new ArrayList<String>();
	ListView muclist;
	Adapter_MultiUserChat adapter;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.multi_user_chat);
		
		user_name = StringUtils.parseName(Koneksi.getInstance().getConnection().getUser());
		
		Typeface font = Typeface.createFromAsset(getAssets(), "fonts/tt0142m_.ttf");
		
		TextView conname = (TextView) findViewById(R.id.muc_name);
        conname.setTypeface(font);
        conname.setText(user_name);
        TextView constatus = (TextView) findViewById(R.id.muc_status);
        constatus.setTypeface(font);
        
        muclist = (ListView) findViewById(R.id.listMUC);
        
        
        
        
        adapter = new Adapter_MultiUserChat(getBaseContext(), room);
        
        muclist.setAdapter(adapter);
        
//        Koneksi.getInstance().MultiUserChatListener();
//        run_muc = new Runnable() {
//			@Override
//			public void run() {
				// TODO Auto-generated method stub
//				Koneksi.getInstance().MultiUserChatListener(getBaseContext());
//				System.out.println("*****run_muc*****");
//				mHandlermuc.postDelayed(this, 2000);
//			}
//		};
//		mHandlermuc.post(run_muc);
        
	}

}
